package com.tensquare.qa.service;

import com.tensquare.qa.dao.ProblemDao;
import com.tensquare.qa.pojo.Problem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Feng.Wang
 * @Company: Zelin.ShenZhen
 * @Description:
 * @Date: Create in 2019/3/23 16:43
 */
@Service
public class ProblemService {
    @Autowired
    private ProblemDao problemDao;
    public Page<Problem> findNewlistByLabelId(String labelid,int page,int size){
        PageRequest pageRequest = PageRequest.of(page-1,size);
        return problemDao.findNewlistByLabelId(labelid,pageRequest);
    }

    /**
     * 发布问题
     * @param problem
     */
    public void add(Problem problem){
        
        problemDao.save(problem);
    }
}
